<script>
$(document).ready(function(){
    $("#permListTable tbody tr:even").addClass('even');
    $("#permListTable tbody tr:odd").addClass('odd');
    $("#print-authorized").click(function(){
        var id = $(".setitem").attr('id').substr(4);
        $.get('<?php echo $this->route("get-authorized")?>',
                {id: id},
                function(data) {
                	$("#aclDailog").html(data);
                	$("#aclDailog").attr('title',"<?php echo $this->translate('Authorized personnel')?> ("+$("#title").val()+")");
                	$("#aclDailog").dialog({
                		  autoOpen:false,
                		   bgiframe: true,
                            height: 300,
                            width:500,
                            modal: true
                       } ).dialog('open');
               });

     });
});
</script>
<style>
.delacl {cursor:pointer ; background-color:#f6f ; color:#fff ; padding:0 2px}
</style>
<div> <a  id="print-authorized"  href="#" class="fg-button fg-button-icon-left" style="float:right" >
<span class="ui-icon ui-icon-circle-zoomout"></span><?php echo $this->translate('Authorized personnel')?></a>
    </div>
 <table id="permListTable" style="clear:both">
	<thead>
		<tr>
			<th><?php echo $this->translate('group')?></th>
			<th><?php echo $this->translate('permission item')?></th>
			<th><?php echo $this->translate('permission')?></th>
			<th><?php echo $this->translate('permission edit')?></th>
		</tr>
	</thead>
	<tbody>
	<?php foreach($this->data as $val):?>
	<tr>
		<td><?php echo $val['role_id']?></td>
		<td style="white-space: normal">
		<?php if ($val['controller']==''):?><?php echo $this->translate('all permission item')?><?php else:?>
		<?php $arr = array();?>
		<?php foreach(explode(":",$val['controller']) as $val2):?>
		<?$arr[] = $this->translate($this->cMenu[$val2])?>
		<?php endforeach?>
		<?php echo  implode(" . ",$arr)?>
	<?php endif?></td>
		<td>
		<?php if($val['allow']):?><span class="allow"><?php echo $this->translate('allow')?></span><?php else:?>
		<span class="deny"><?php echo $this->translate('deny')?></span>
		<?php endif;?>
		</td>
		<td>
		<?php if ($val['id'] == $this->id):?>
		<span class="delacl" id="d-<?php echo $val['acl_access_id']?>"><?php echo $this->translate('delete')?></span>
		<?php else:?>
		<span><?php echo $this->translate('authorized by the upper')?></span>
		<?php endif;?>
		</td>
	</tr>
	<?php endforeach;?>
	</tbody>
</table>
<div id="aclDailog" title="<?php echo $this->translate('Authorized personnel')?>">

</div>
